﻿<%@ Page Language="C#" Theme="WebMaster" MasterPageFile="~/WebMaster/MasterPage.master" AutoEventWireup="true" CodeFile="Orders.aspx.cs" Inherits="webapp4U.UI.WebMaster_Default" %>
<%@ Register Src="~/WebMaster/Controls/Title.ascx" TagName="Title" TagPrefix="uc" %>
<%@ Import Namespace="webapp4U" %>
<%@ Register TagPrefix="webapp4U" Namespace="webapp4U.UI" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PageContent" Runat="Server">

<uc:Title runat="server" ResourceKey='Product_OrderManager'  />
<br />

        <table width="700" align="center">
            <tr>
                <td align="center">
                    <asp:Panel runat="server"  ID="donhang" Width="450px" GroupingText="LỌC ĐƠN ĐẶT HÀNG">
                        <table border="0" cellpadding="7" align="center">
                                <tr>
                                    <td align="right" style="font-weight:bold">Từ khóa:</td>
                                    <td align="left">
                                        <asp:TextBox ID="txtKeyword" runat="server" Width="213"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right" style="font-weight:bold">Trạng thái:</td>
                                    <td align="left">
                                        <asp:DropDownList ID="dlTrangthai" runat="server" Width="218">
                                            <asp:ListItem Value="-1" Text="Tất cả"></asp:ListItem>
                                            <asp:ListItem Value="1" Text="Chưa thanh toán"></asp:ListItem>
                                            <asp:ListItem Value="2" Text="Đã thanh toán"></asp:ListItem>
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right" style="font-weight:bold">Khoảng thời gian:</td>
                                    <td align="left">
                                        Từ: 
                                        <asp:TextBox ID="txtFromDate" runat="server" Width="70" Text="mm/dd/yy" /> 
                                        &nbsp;
                                        Đến: 
                                        <asp:TextBox ID="txtToDate" runat="server" Width="70" Text="mm/dd/yy" />
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right" colspan="2">
                                        <asp:LinkButton runat="server" ID="LinkButton2" Text=" Search " OnClick="btSearch_Click" />
                                        <br />
                                    </td>
                                </tr>
                         </table>
                    </asp:Panel>  
                </td>
            </tr>
            <tr>
                <td align="right">
                    <br />
                    <asp:LinkButton runat="server" ID="LinkButton1" Text=" Đã thanh toán " OnClick="btDathanhtoan_Click" />
                    <br />
                </td>
            </tr>
            <tr>
                <td align="center">
                    <br />
                    <asp:GridView runat="server" Width="700" DataSourceID="ItemDataSource" ID="GridViewItem">
                        <Columns>
                             <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20px" HeaderStyle-Width="20px">
                                <HeaderTemplate>
                                    <input id="chkAll" onclick="javascript:SelectAllCheckboxes(this);" runat="server"
                                        type="checkbox" />
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:CheckBox runat="server" ID="chkSelect" ToolTip='<%# Eval("OrderID") %>' />
                                </ItemTemplate>
                            </asp:TemplateField>
                            
                             <asp:TemplateField HeaderText="ID" HeaderStyle-Width="40" ItemStyle-Width="40"  
                                HeaderStyle-HorizontalAlign="left" ItemStyle-HorizontalAlign="left">
                                <ItemTemplate>
                                    <a href="OrderItems.aspx?OrderID=<%# Eval("OrderID")%>"><u><%# Eval("OrderID")%></u></a>
                                </ItemTemplate>
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="Company" HeaderStyle-HorizontalAlign="left" ItemStyle-HorizontalAlign="left">
                                <HeaderTemplate><%=ResourceManager.GetString("FullName") %></HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("ShippingName")%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            
                             <asp:TemplateField HeaderText="Email" HeaderStyle-Width="150" ItemStyle-Width="150"  
                                HeaderStyle-HorizontalAlign="left" ItemStyle-HorizontalAlign="left">
                                <ItemTemplate>
                                    <%# Eval("CustomerEmail") %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="Phone" HeaderStyle-Width="100" HeaderStyle-HorizontalAlign="left"
                                ItemStyle-Width="100" ItemStyle-HorizontalAlign="left">
                                <HeaderTemplate><%=ResourceManager.GetString("Phone")%></HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("CustomerPhone")%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            
                             <asp:TemplateField ItemStyle-Width="70"  HeaderStyle-Width="70" 
                                HeaderStyle-HorizontalAlign="left" ItemStyle-HorizontalAlign="left">
                                <HeaderTemplate><%=ResourceManager.GetString("Date")%></HeaderTemplate>
                                <ItemTemplate>
                                    <%# Formatter.FormatDate((DateTime)Eval("AddedDate")) %>
                                </ItemTemplate>
                            </asp:TemplateField>
                           
                           
                            <asp:TemplateField HeaderText="Phone" HeaderStyle-Width="100" ItemStyle-Width="100" 
                                HeaderStyle-HorizontalAlign="left" ItemStyle-HorizontalAlign="left">
                                <HeaderTemplate><%=ResourceManager.GetString("Product_OrderStatus")%></HeaderTemplate>
                                <ItemTemplate><%# ((int)Eval("StatusID")==1) ? "Chưa thanh toán": "<font color=red>Đã thanh toán</font>"  %></ItemTemplate>
                            </asp:TemplateField>
                           
                           
                        </Columns>
                        <EmptyDataTemplate>
                            <table align="center" width="300" border="0" bordercolorlight="#0099cc" bordercolor="#0099cc">
                                <tr>
                                    <td height="50" align="center">
                                        <div align="center" id="EmptyData">
                                            <%=ResourceManager.GetString("Product_OrdersEmpty") %>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </EmptyDataTemplate>
                    </asp:GridView>
                </td>
            </tr>
            <tr>
                <td align="right">
                    <br />
                    <asp:LinkButton runat="server" ID="btDelete" Text=" Delete " OnClick="btDelete_Click" />
                    <br />
                </td>
            </tr>
            
           <tr>
                <td>
                    <br />
                    <u>Ghi chú:</u> Click vào ID để Xem thông tin chi tiết về đơn hàng đó.
                </td>
            </tr>
        </table>


    


<asp:ObjectDataSource
    ID="SearchDataSource"
    runat="server"
    SelectMethod="Search"
    TypeName="webapp4U.BOL.Orders">
    <SelectParameters>
        <asp:ControlParameter ControlID="txtKeyword" Name="Keyword" PropertyName="Text" Type="string" DefaultValue=" "  />
        <asp:ControlParameter ControlID="dlTrangthai" Name="StatusID" PropertyName="SelectedValue" Type="int32" DefaultValue="-1"  />
        <asp:ControlParameter ControlID="txtFromDate" Name="FromDate" PropertyName="Text" Type="string" DefaultValue=" "  />
        <asp:ControlParameter ControlID="txtToDate" Name="ToDate" PropertyName="Text" Type="string" DefaultValue=" "  />
    </SelectParameters>
</asp:ObjectDataSource>


<asp:ObjectDataSource
    ID="ItemDataSource"
    runat="server"
    SelectMethod="GetAllOrders"
    TypeName="webapp4U.BOL.Orders">
</asp:ObjectDataSource>




</asp:Content>

